package com.cetcs.kmga.dataManager.entity.dataManager.vo;


import org.springframework.util.StringUtils;

/**
 * Created by root on 2017/9/25.
 */
public class SecuRuleAlertCondition {

    private int id;

    //告警规则ID
    private int ruleId;

    //操作类型
    private String operType;

    //客户端IP判断规则:0：等于，1：不等于
    private int ipsetCmp;

    //客户端IP集合ID
    private String ipsetId;

    //时间规则:时间频率
    private String weekDays;

    //时间规则:起始时间,只需要时分,默认00:00
    private String dayStart;

    //时间规则:结束时间，只需要时分,默认值：23:59
    private String dayEnd;

    /**
     * 检查时间顺序:开始时间是否 早于 结束时间
     * @return
     */
    public boolean checkTime(){
        if(StringUtils.isEmpty(dayStart) || StringUtils.isEmpty(dayEnd)){ return true;}
        int startHour = Integer.valueOf(dayStart.substring(0,2));
        int startMinute = Integer.valueOf(dayStart.substring(3));

        int endHour = Integer.valueOf(dayEnd.substring(0,2));
        int endMinute = Integer.valueOf(dayEnd.substring(3));
        if((startHour * 60 + startMinute) <= (endHour * 60 + endMinute) ){
            return true;
        }
        return false;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getRuleId() {
        return ruleId;
    }

    public void setRuleId(int ruleId) {
        this.ruleId = ruleId;
    }

    public String getOperType() {
        return operType;
    }

    public void setOperType(String operType) {
        this.operType = operType;
    }

    public int getIpsetCmp() {
        return ipsetCmp;
    }

    public void setIpsetCmp(int ipsetCmp) {
        this.ipsetCmp = ipsetCmp;
    }

    public String getIpsetId() {
        return ipsetId;
    }

    public void setIpsetId(String ipsetId) {
        this.ipsetId = ipsetId;
    }

    public String getWeekDays() {
        return weekDays;
    }

    public void setWeekDays(String weekDays) {
        this.weekDays = weekDays;
    }

    public String getDayStart() {
        return dayStart;
    }

    public void setDayStart(String dayStart) {
        this.dayStart = dayStart;
    }

    public String getDayEnd() {
        return dayEnd;
    }

    public void setDayEnd(String dayEnd) {
        this.dayEnd = dayEnd;
    }
}
